import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/16 20:54
 * @description 模拟
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int giveGem(int[] gem, int[][] operations) {
        for (int[] op : operations) {
            int value = gem[op[0]] / 2;
            gem[op[0]] -= value;
            gem[op[1]] += value;
        }
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
        for (int i : gem) {
            if (i > max) {
                max = i;
            }
            if (i < min) {
                min = i;
            }
        }
        return max - min;
    }
}
